// index.ts
Page({
  data: {
    arr: [1, 2, 3],
    obj: {
      name: "小明",
      age: 22,
    },
    obj1: {
      a: 100,
    },
    isshow: true,
    count: 1,
    id: 1,
    islogin: true,
    globalName: "",
  },
  app: {} as ICommon,
  onLoad() {
    this.app = getApp<IAppOption>();
    console.log(this.app.globalData.gName);
    this.setData({
      globalName: this.app.globalData.gName,
    });
  },
  onShow() {
    if (typeof this.getTabBar === "function" && this.getTabBar()) {
      this.getTabBar().setData({
        selected: 0,
      });
    }
  },
  receiveData(data: string) {
    console.log("---", data);
  },
  setName() {
    this.app.globalData.gName = "全局小王";
    this.setData({
      globalName: this.app.globalData.gName,
    });
  },
});
